/*!
\file ActionCommunicator.h
\brief Contains declaration of ActionCommunicator.
\ingroup Action
\ingroup GUI
*/

#ifndef ACTIONCOMMUNICATOR_H
#define ACTIONCOMMUNICATOR_H

#include<QObject>
#include"VisualizationSettings.h"

/*!
\class ActionCommunicator
\brief Communication class with no other dependencies than VisualizationSettings designed to be used by Actions to call functions that are coupled with calls elsewhere. Basically, this is the link between the GUI and the underlying system. Each function call will result in the emission of a similar signal.
\ingroup Action
\ingroup Gui
*/

class ActionCommunicator: public QObject{
Q_OBJECT
public:
	ActionCommunicator();
	//!< Constructor
	~ActionCommunicator();
	//!< Destructor.
	
	VisualizationSettings *settings()const{ return m_settings; }
	//!< Returns VisualizationSettings.
	
	void comment( QString comment );
	//!< Called to have a comment displayed.
	
	void addNode( QString nodeData );
	//!< Called when a Node is added.
	void addEdge( QString edgeData );
	//!< Called when an Edge is added.
	void setNodeOption( int nodeID, QString option, QString value );
	//!< Called to change a DOT option for a Node.
	void setEdgeOption( int edgeID, QString option, QString value );
	//!< Called to change a DOT option for an Edge.
	void removeNode( int nodeID );
	//!< Called when a Node is removed.
	void removeEdge( int edgeID );
	//!< Called when an Edge is removed.
	void removeContainer( int containerID );
	//!< Called when a Container is removed.
	void nodeAccess( int nodeID );
	//!< Called when a Node is accessed.
	void edgeAccess( int edgeID );
	//!< Called when an Edge is accessed.
	void containerNewElement( int container, int id );
	//!< Called when a new ContainerElement is added to a Container.
	void containerRemoveElement( int container, int id );
	//!< Called when a ContainerElement is removed from a Container.
	void containerSetNode( int container, int id, int nodeID, QString label = "" );
	//!< Called when a Node is set in a ContainerElement.
	void containerSetEdge( int container, int id, int from, int to, QString label );
	//!< Called when an Edge is set in a ContainerElement.
	void containerSetData( int container, int id, QString data );
	//!< Called when data is set in a ContainerElement.
signals:
	void logComment( QString comment );
	//!< Emitted when a comment should be shown.
	void nodeAdd( QString nodeData );
	//!< Emitted when a Node was added.
	void edgeAdd( QString edgeData );
	//!< Emitted when an Edge was added.
	void nodeSetOption( int nodeID, QString option, QString value );
	//!< Emitted to change a DOT option for a Node.
	void edgeSetOption( int edgeID, QString option, QString value );
	//!< Emitted to change a DOT option for an Edge.
	void nodeRemove( int nodeID );
	//!< Emitted when a Node was removed.
	void edgeRemove( int edgeID );
	//!< Emitted when an Edge was removed.
	void containerRemove( int containerID );
	//!< Emitted when a Container was removed.
	void accessNode( int nodeID );
	//!< Emitted when a Node was accessed.
	void accessEdge( int edgeID );
	//!< Emitted when an Edge was accessed.
	void newContainerElement( int container, int id );
	//!< Emitted when a new ContainerElement was added to a Container.
	void removeContainerElement( int container, int id );
	//!< Emitted when a ContainerElement was removed from a Container.
	void setContainerNode( int container, int id, int nodeID, QString label );
	//!< Emitted when a Node was set in a ContainerElement.
	void setContainerEdge( int container, int id, int from, int to, QString label );
	//!< Emitted when an Edge was set in a ContainerElement.
	void setContainerData( int container, int id, QString data );
	//!< Emitted when data was set in a ContainerElement.
private:
	VisualizationSettings *m_settings;
};

#endif
